local jixi = fk.CreateSkill({
    name = "sj4__jixi",
  })
  
  Fk:loadTranslationTable{
    ["sj4__jixi"] = "急袭",
    [":sj4__jixi"] = "你可以将一张牌（点数须大于上一次）当【顺手牵羊】使用，若点数大于上一次的两倍则此牌无距离限制。",
    ["@sj4__jixi"] = "急袭",
  
    ["#sj4__jixi-ask"] = "急袭：你可以将一张大于 %arg 点的牌当【顺手牵羊】使用",
    ["#sj4__jixi-ask2"] = "急袭：你可以将一张大于 %arg 点的牌当【顺手牵羊】使用，若大于 %arg2 点则此牌无距离限制",
  
    ["$sj4__jixi1"] = "奇兵正攻，敌何能为？",
    ["$sj4__jixi2"] = "明至剑阁，暗袭蜀都！",
  }
  
  jixi:addEffect("viewas", {
    anim_type = "control",
    pattern = "snatch",
    prompt = function (self, player, selected_cards, selected)
      local i = player:getMark("@sj4__jixi")
      local n = i*2
      if i>10 then
        i = Card:getNumberStr(i)
      end
      local ask = "#sj4__jixi-ask:::"..i
      if not (n>13) then
        if n>10 then
          return "#sj4__jixi-ask2:::"..i..":"..Card:getNumberStr(n)
        end
        return "#sj4__jixi-ask2:::"..i..":"..n
      end
      return ask--提示文本
    end,
    card_filter = function (self, player, to_select, selected)
      return (Fk:getCardById(to_select).number > player:getMark("@sj4__jixi")) and #selected == 0
    end,
    view_as = function (self, player, cards)
      if #cards ~= 1 then return nil end
      local c = Fk:cloneCard("snatch")
      c.skillName = jixi.name
      c:addSubcard(cards[1])
      return c
    end,
    before_use = function(self, player, use)
      player.room:setPlayerMark(player, "@sj4__jixi", use.card.number)
    end,
    enabled_at_play = function (self, player)
      return table.find(player:getCardIds("he"),function (id)
        return Fk:getCardById(id).number > player:getMark("@sj4__jixi")
      end)
    end,
    enabled_at_response = function (self, player, response)
      return not response and table.find(player:getCardIds("he"),function (id)
        return Fk:getCardById(id).number > player:getMark("@sj4__jixi")
      end)
    end,
  })

  jixi.onLose = function (self, player, is_start)
    player.room:setPlayerMark(player, "@sj4__jixi", 0)
  end

  jixi:addEffect("targetmod", {
    bypass_distances = function(self, player, skill, card)
      return player:hasSkill(jixi.name) and card.skillName == jixi.name and 
      card.number > (player:getMark("@sj4__jixi") *2)
    end,
  })

  return jixi